package snowflake.demo.service;

import com.github.yitter.contract.IdGeneratorOptions;
import com.github.yitter.idgen.YitIdHelper;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

@Service
public class snowflakeservice {
    
    @PostConstruct
    public void init() {
        IdGeneratorOptions options = new IdGeneratorOptions((short)1);
        YitIdHelper.setIdGenerator(options);
    }
    
    public Long getId(){
        return YitIdHelper.nextId();
    }
}
